package smartcode;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.ExpandableListView;

import com.aliang.auto.R;

import java.util.ArrayList;

import app.auto.runner.base.widget.expandable.ExpandableAdapter;

public class BodyActivity extends AppCompatActivity {
    private ArrayList<String> mGroupList;
    //item数据
    private ArrayList<ArrayList<String>> mItemSet;
    private ExpandableListView mExpandableListView;

    private void initData() {
        mGroupList = new ArrayList<>();
        mGroupList.add("我的家人");
        mGroupList.add("我的朋友");
        mGroupList.add("黑名单");
        mItemSet = new ArrayList<>();
        ArrayList<String> itemList1 = new ArrayList<>();
        itemList1.add("大妹");
        itemList1.add("二妹");
        itemList1.add("三妹");
        ArrayList<String> itemList2 = new ArrayList<>();
        itemList2.add("大美");
        itemList2.add("二美");
        itemList2.add("三美");
        ArrayList<String> itemList3 = new ArrayList<>();
        itemList3.add("狗蛋");
        itemList3.add("二丫");
        mItemSet.add(itemList1);
        mItemSet.add(itemList2);
        mItemSet.add(itemList3);
    }
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_body);
        mExpandableListView = findViewById(R.id.expand_lv);
        String bodytitle = getIntent().getStringExtra("bodytitle");
        if (!TextUtils.isEmpty(bodytitle)) {
            setTitle(bodytitle);
        } else {
            setTitle("newClass");
        }
        initData();
        ExpandableAdapter adapter = new ExpandableAdapter(this, mGroupList, mItemSet);
        mExpandableListView.setAdapter(adapter);
    }
}